'use strict'

process.chdir(__dirname)

const {checkThrow, autoCheck, checkVal} = require('../index')

try {
  checkThrow({min: 124, max: 345}, 123)
} catch (err) {
  console.error(err.message)
}

try {
  checkThrow({match: /^(12|13|14|15|16|17|18|19)[0-9]{9}$/i}, '12345678801')
  console.log('ok')
} catch (err) {
  console.log(err.message)
}

console.log('check value', checkVal({list: ['ubuntu', 'mint', 'deepin', 'debian']}, 'debian') )

let config = {}

console.log(autoCheck(config, 'age', {
  min: 18,
  max: 45,
  default: 30
}, 12))

console.log(config)

